//
// Delaunay Triangulation
//
// Homework of CG lesson (Fall 2009) in Tsinghua University.
// All rights reserved.
//

#pragma once

#include "point2d.h"

/**
 * The class for Line2d.
 */
class Line2d
{
// public constructors & destructor
public:
    /**
     * Sets all the line parameters to 1.0 by default.
     */
    Line2d(void);
    /**
     * Line passes by two points, start point @c p1 and end point @c p2.
     */
    Line2d(const Point2d& p1, const Point2d& p2);

// public member functions
public:
    /**
     * Returns the value of a * p.x + b * p.y + c.
     */
    double eval(const Point2d& p) const;
    /**
     * Classifies the point @c p is whether to the left, to the right,
     * or just on the line.
     * @return -1 when is to the left;
     * @return 1 when is to the right;
     * @return 0 when is on the line.
     */
    int classify(const Point2d& p) const;

// public data members
public:
    /**
     * These line parameters meet the equation ax + by + c = 0;
     */
    double a, b, c;
};
